gdk: Deliver queued events on flush
authorMatthias Clasen <mclasen@redhat.com>
Fri, 23 Oct 2020 21:03:00 +0000 (17:03 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 23 Oct 2020 21:03:00 +0000 (17:03 -0400)
The current code was marking queued events as flushed,
but left them in the queue. That doesn't make sense to
me - we should deliver all events we have before we
reach the paint phase of the frame cycle.

gdk/gdkevents.c

index c768d22f239870da7123621cdce86dec8f4a1281..9cfefd0d398d68b3acccd9c87150daadb65d3fec 100644 (file)
@@ -814,12 +814,17 @@ _gdk_event_queue_handle_motion_compression (GdkDisplay *display)
 void
 _gdk_event_queue_flush (GdkDisplay *display)
 {
-  GList *tmp_list;
-
-  for (tmp_list = display->queued_events.head; tmp_list; tmp_list = tmp_list->next)
+  while (TRUE)
     {
-      GdkEvent *event = tmp_list->data;
+      GdkEvent *event;
+
+      event = (GdkEvent *)g_queue_pop_head (&display->queued_events);
+      if (!event)
+        return;
+
       event->flags |= GDK_EVENT_FLUSHED;
+      _gdk_event_emit (event);
+      gdk_event_unref (event);
     }
 }